package com.huali.principle.inversion.improve;

/**
 * @author MicahYin
 * @date 2020/11/6 16:43
 */
public class DependencyInversion {
    public static void main(String[] args) {
        Person person = new Person();
        person.receive(new Email());
        person.receive(new WeiXin());
    }
}
interface IReceiver{
    String getInfo();
}
class Email implements IReceiver{
    public String getInfo(){
        return "电子邮件信息：hello world......";
    }
}
class WeiXin implements IReceiver{
    public String getInfo(){
        return "微信消息：hello......,my name is weChat";
    }
}

class Person{
    public void receive(IReceiver receiver){
        System.out.println(receiver.getInfo());
    }
}
